s1 = "hello world"
print(s1 + "echo")
print(s1 * 3)
print(len(s1))
print(max(s1),min(s1))
print("s" in s1)
print("abcd" < "abcde")

# 字符串遍历
for item in s1:
    print(item)

for index,value in enumerate(s1):
    print(index,value)

print("🌈" * 20)

for i in range(len(s1)):
    print(i,s1[i])


# 类型转换
print(str(12),type(str(12))) # int --> str
print(str([1,2,3,4]),type(str([1,2,3,4])))
print(str((1,)),type(str((1,))))

# 常用方法
print(s1.islower())
print(s1.isupper())

print(s1.count('o'))
print(s1.strip())
print(s1.split(" "))

# 字符串统计
s = input('请输入一篇文章：')
a,b,c = 0,0,0 # 数字、字母、符号
for i in s:
    if i.isdigit():
        a += 1
    elif i.isalpha():
        b += 1
    else:
        c += 1
print(a,b,c)

